package com.example.demo.exception;

import lombok.Getter;

/**
 * @Author hweiyu
 * @Description
 * @Date 2022/6/28 17:28
 */
@Getter
public class BusinessException extends RuntimeException {

    private Integer code;

    private String msg;

    public BusinessException() {
        this(ErrorCode.UNKNOWN);
    }

    public BusinessException(Error error) {
        this(error.getCode(), error.getMsg());
    }

    public BusinessException(Integer code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }
}
